<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{:config("app.app_name")}</title>
  <meta name="keywords" content="">
  <meta name="description" content="">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta http-equiv="Access-Control-Allow-Origin" content="*">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
  <link href="__STATIC__/layui/css/layui.css" rel="stylesheet">
  <link rel="stylesheet" href="__STATIC__/css/layuimini.css?v=2.0.4.2" media="all">
  <link rel="stylesheet" href="__STATIC__/css/public.css?v=2.0.4.3" media="all">
  <link rel="stylesheet" href="__STATIC__/css/themes/default.css" media="all">
  <!--[if lt IE 9]>
  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
  <style>

  </style>
</head>
<body  >
<div class="layuimini-container">
  <div class="layuimini-main">
    <form class="layui-form layuimini-form">
      <div class="layui-form-item">
        <div class="layui-input-group layuimini-input-group">
          <div class="layui-input-prefix layui-input-split layuimini-input-prefix">名称</div>
          <input type="text" name="title" value="{$auth_group.title}" required lay-verify="required" placeholder="请输入权限组名称" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-group layuimini-input-group">
          <div class="layui-input-prefix layui-input-split layuimini-input-prefix">状态</div>
          <div class="layui-input-div">
            <input type="radio" name="status" value="1" title="启用" {if condition="$auth_group.status==1"} checked="checked"{/if}>
            <input type="radio" name="status" value="0" title="禁用" {if condition="$auth_group.status==0"} checked="checked"{/if}>
          </div>
      </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">

          <button  class="layui-btn {:checkAutoBtn('admin/AuthGroup/update')?'':'layui-hide'}" lay-submit lay-filter="submit">保存</button>

          <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
  </div>
</div>
<script src="__JS__/jquery.min.js"></script>
<script src="__STATIC__/layui/layui.js"></script>
<script src="__STATIC__/layui/lay-config.js?v=2.0.0" charset="utf-8"></script>
<script src="__JS__/common.js"></script>
<script>
  layui.use(function () {
    var form = layui.form;
    var layer = layui.layer;
    // 提交事件
    form.on('submit(submit)', function(data){
      var field = data.field; // 获取表单字段值
      Ajax('/admin/AuthGroup/'+"{$auth_group['id']}",'put',$(data.form).serialize(),
              success=function (info) {
                if (info.code === 1) {
                  layer.confirm(info.msg, {icon: 1,btn: ['返回列表'],cancel: function(){
                      window.location.href = ""
                    }}, function(){
                    layer.close(layer.index);
                    window.parent.location.reload();
                  });
                }else{
                  layer.msg(info.msg)
                }
              },error=function(e){
                console.log(e,22)
              }
      );

      return false; // 阻止默认 form 跳转
    });
  });
</script>
</body>
</html>
